package cn.jaye.fabric.common.util;

import java.util.Random;
import java.util.UUID;

/**
 * @author Jaye
 * @create 2018-05-23 14:17
 */
public class KeyIDUtil {
    public static String getRandomString(int length) {
        String base = "abcdefghijklmnopqrstuvwxyzQWERTYUIOPASDFGHJKLZXCVBNM0123456789&-#$%*!(){}";
        Random random = new Random();
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < length; i++) {
            int number = random.nextInt(base.length());
            sb.append(base.charAt(number));
        }
        return sb.toString();
    }

    public static String getUUID() {
        return UUID.randomUUID().toString().replace("-", "");
    }
}
